<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GPollableInputStream</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="streaming.html" title="Streaming I/O">
<link rel="prev" href="gio-GConverterOutputstream.html" title="GConverterOutputstream">
<link rel="next" href="GPollableOutputStream.html" title="GPollableOutputStream">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gio-GConverterOutputstream.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="streaming.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="GPollableOutputStream.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GPollableInputStream.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GPollableInputStream.description" class="shortcut">Description</a>
                   | 
                  <a href="#GPollableInputStream.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GPollableInputStream.prerequisites" class="shortcut">Prerequisites</a>
                   | 
                  <a href="#GPollableInputStream.implementations" class="shortcut">Known Implementations</a>
</td></tr>
</table>
<div class="refentry">
<a name="GPollableInputStream"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GPollableInputStream.top_of_page"></a>GPollableInputStream</span></h2>
<p>GPollableInputStream — Interface for pollable input streams</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GPollableInputStream.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gio/gio.h&gt;

                    <a class="link" href="GPollableInputStream.html#GPollableInputStream-struct" title="GPollableInputStream">GPollableInputStream</a>;
struct              <a class="link" href="GPollableInputStream.html#GPollableInputStreamInterface" title="struct GPollableInputStreamInterface">GPollableInputStreamInterface</a>;

<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-can-poll" title="g_pollable_input_stream_can_poll ()">g_pollable_input_stream_can_poll</a>    (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>);
<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-is-readable" title="g_pollable_input_stream_is_readable ()">g_pollable_input_stream_is_readable</a> (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>);
<a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="returnvalue">GSource</span></a> *           <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-create-source" title="g_pollable_input_stream_create_source ()">g_pollable_input_stream_create_source</a>
                                                        (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);
<a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-read-nonblocking" title="g_pollable_input_stream_read_nonblocking ()">g_pollable_input_stream_read_nonblocking</a>
                                                        (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><span class="type">void</span> *buffer</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);

<a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="GPollableInputStream.html#GPollableSourceFunc" title="GPollableSourceFunc ()">*GPollableSourceFunc</a>)              (<em class="parameter"><code><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *pollable_stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="returnvalue">GSource</span></a> *           <a class="link" href="GPollableInputStream.html#g-pollable-source-new" title="g_pollable_source_new ()">g_pollable_source_new</a>               (<em class="parameter"><code><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *pollable_stream</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GPollableInputStream.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  GInterface
   +----GPollableInputStream
</pre>
</div>
<div class="refsect1">
<a name="GPollableInputStream.prerequisites"></a><h2>Prerequisites</h2>
<p>
GPollableInputStream requires
 <a class="link" href="GInputStream.html" title="GInputStream">GInputStream</a>.</p>
</div>
<div class="refsect1">
<a name="GPollableInputStream.implementations"></a><h2>Known Implementations</h2>
<p>
GPollableInputStream is implemented by
 <a class="link" href="GUnixInputStream.html" title="GUnixInputStream">GUnixInputStream</a>.</p>
</div>
<div class="refsect1">
<a name="GPollableInputStream.description"></a><h2>Description</h2>
<p>
<a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> is implemented by <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>s that
can be polled for readiness to read. This can be used when
interfacing with a non-GIO API that expects
UNIX-file-descriptor-style asynchronous I/O rather than GIO-style.
</p>
</div>
<div class="refsect1">
<a name="GPollableInputStream.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GPollableInputStream-struct"></a><h3>GPollableInputStream</h3>
<pre class="programlisting">typedef struct _GPollableInputStream GPollableInputStream;</pre>
<p>
An interface for a <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> that can be polled for readability.
</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="GPollableInputStreamInterface"></a><h3>struct GPollableInputStreamInterface</h3>
<pre class="programlisting">struct GPollableInputStreamInterface {
  GTypeInterface g_iface;

  /* Virtual Table */
  gboolean     (*can_poll)         (GPollableInputStream  *stream);

  gboolean     (*is_readable)      (GPollableInputStream  *stream);
  GSource *    (*create_source)    (GPollableInputStream  *stream,
				    GCancellable          *cancellable);
  gssize       (*read_nonblocking) (GPollableInputStream  *stream,
				    void                  *buffer,
				    gsize                  size,
				    GError               **error);
};
</pre>
<p>
The interface for pollable input streams.
</p>
<p>
The default implementation of <em class="parameter"><code>can_poll</code></em> always returns <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
</p>
<p>
The default implementation of <em class="parameter"><code>read_nonblocking</code></em> calls
<a class="link" href="GPollableInputStream.html#g-pollable-input-stream-is-readable" title="g_pollable_input_stream_is_readable ()"><code class="function">g_pollable_input_stream_is_readable()</code></a>, and then calls
<a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()"><code class="function">g_input_stream_read()</code></a> if it returns <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. This means you only need
to override it if it is possible that your <em class="parameter"><code>is_readable</code></em>
implementation may return <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> when the stream is not actually
readable.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a href="./../gobject/gobject/gobject-Type-Information.html#GTypeInterface"><span class="type">GTypeInterface</span></a> <em class="structfield"><code><a name="GPollableInputStreamInterface.g-iface"></a>g_iface</code></em>;</span></p></td>
<td>The parent interface.</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GPollableInputStreamInterface.can-poll"></a>can_poll</code></em> ()</span></p></td>
<td>Checks if the <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> instance is actually pollable</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GPollableInputStreamInterface.is-readable"></a>is_readable</code></em> ()</span></p></td>
<td>Checks if the stream is readable</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GPollableInputStreamInterface.create-source"></a>create_source</code></em> ()</span></p></td>
<td>Creates a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> to poll the stream</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="GPollableInputStreamInterface.read-nonblocking"></a>read_nonblocking</code></em> ()</span></p></td>
<td>Does a non-blocking read or returns
<a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-pollable-input-stream-can-poll"></a><h3>g_pollable_input_stream_can_poll ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_pollable_input_stream_can_poll    (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>stream</code></em> is actually pollable. Some classes may implement
<a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> but have only certain instances of that class
be pollable. If this method returns <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then the behavior of
other <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> methods is undefined.
</p>
<p>
For any given stream, the value returned by this method is constant;
a stream cannot switch from pollable to non-pollable or vice versa.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>stream</code></em> is pollable, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-pollable-input-stream-is-readable"></a><h3>g_pollable_input_stream_is_readable ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_pollable_input_stream_is_readable (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>);</pre>
<p>
Checks if <em class="parameter"><code>stream</code></em> can be read.
</p>
<p>
Note that some stream types may not be able to implement this 100%
reliably, and it is possible that a call to <a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()"><code class="function">g_input_stream_read()</code></a>
after this returns <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> would still block. To guarantee
non-blocking behavior, you should always use
<a class="link" href="GPollableInputStream.html#g-pollable-input-stream-read-nonblocking" title="g_pollable_input_stream_read_nonblocking ()"><code class="function">g_pollable_input_stream_read_nonblocking()</code></a>, which will return a
<a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a> error rather than blocking.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>stream</code></em> is readable, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if not. If an error
has occurred on <em class="parameter"><code>stream</code></em>, this will result in
<a class="link" href="GPollableInputStream.html#g-pollable-input-stream-is-readable" title="g_pollable_input_stream_is_readable ()"><code class="function">g_pollable_input_stream_is_readable()</code></a> returning <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, and the
next attempt to read will return the error.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-pollable-input-stream-create-source"></a><h3>g_pollable_input_stream_create_source ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="returnvalue">GSource</span></a> *           g_pollable_input_stream_create_source
                                                        (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>);</pre>
<p>
Creates a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> that triggers when <em class="parameter"><code>stream</code></em> can be read, or
<em class="parameter"><code>cancellable</code></em> is triggered or an error occurs. The callback on the
source is of the <a class="link" href="GPollableInputStream.html#GPollableSourceFunc" title="GPollableSourceFunc ()"><span class="type">GPollableSourceFunc</span></a> type.
</p>
<p>
As with <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-is-readable" title="g_pollable_input_stream_is_readable ()"><code class="function">g_pollable_input_stream_is_readable()</code></a>, it is possible that
the stream may not actually be readable even after the source
triggers, so you should use <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-read-nonblocking" title="g_pollable_input_stream_read_nonblocking ()"><code class="function">g_pollable_input_stream_read_nonblocking()</code></a>
rather than <a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()"><code class="function">g_input_stream_read()</code></a> from the callback.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-pollable-input-stream-read-nonblocking"></a><h3>g_pollable_input_stream_read_nonblocking ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gssize"><span class="returnvalue">gssize</span></a>              g_pollable_input_stream_read_nonblocking
                                                        (<em class="parameter"><code><a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code><span class="type">void</span> *buffer</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> size</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Attempts to read up to <em class="parameter"><code>size</code></em> bytes from <em class="parameter"><code>stream</code></em> into <em class="parameter"><code>buffer</code></em>, as
with <a class="link" href="GInputStream.html#g-input-stream-read" title="g_input_stream_read ()"><code class="function">g_input_stream_read()</code></a>. If <em class="parameter"><code>stream</code></em> is not currently readable,
this will immediately return <a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a>, and you can
use <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-create-source" title="g_pollable_input_stream_create_source ()"><code class="function">g_pollable_input_stream_create_source()</code></a> to create a <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a>
that will be triggered when <em class="parameter"><code>stream</code></em> is readable.
</p>
<p>
Note that since this method never blocks, you cannot actually
use <em class="parameter"><code>cancellable</code></em> to cancel it. However, it will return an error
if <em class="parameter"><code>cancellable</code></em> has already been cancelled when you call, which
may happen if you call this method after a source triggers due
to having been cancelled.
</p>
<p>
Virtual: read_nonblocking
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>a <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td>a buffer to read data into (which should be at least <em class="parameter"><code>size</code></em>
bytes long).</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td>the number of bytes you want to read</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>
<a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for error reporting, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the number of bytes read, or -1 on error (including
<a class="link" href="gio-GIOError.html#G-IO-ERROR-WOULD-BLOCK:CAPS"><code class="literal">G_IO_ERROR_WOULD_BLOCK</code></a>).</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GPollableSourceFunc"></a><h3>GPollableSourceFunc ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            (*GPollableSourceFunc)              (<em class="parameter"><code><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *pollable_stream</code></em>,
                                                         <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
This is the function type of the callback used for the <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a>
returned by <a class="link" href="GPollableInputStream.html#g-pollable-input-stream-create-source" title="g_pollable_input_stream_create_source ()"><code class="function">g_pollable_input_stream_create_source()</code></a> and
<a class="link" href="GPollableOutputStream.html#g-pollable-output-stream-create-source" title="g_pollable_output_stream_create_source ()"><code class="function">g_pollable_output_stream_create_source()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pollable_stream</code></em> :</span></p></td>
<td>the <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> or <a class="link" href="GPollableOutputStream.html" title="GPollableOutputStream"><span class="type">GPollableOutputStream</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>data passed in by the user.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>it should return <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the source should be removed.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-pollable-source-new"></a><h3>g_pollable_source_new ()</h3>
<pre class="programlisting"><a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="returnvalue">GSource</span></a> *           g_pollable_source_new               (<em class="parameter"><code><a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> *pollable_stream</code></em>);</pre>
<p>
Utility method for <a class="link" href="GPollableInputStream.html" title="GPollableInputStream"><span class="type">GPollableInputStream</span></a> and <a class="link" href="GPollableOutputStream.html" title="GPollableOutputStream"><span class="type">GPollableOutputStream</span></a>
implementations. Creates a new <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> that expects a callback of
type <a class="link" href="GPollableInputStream.html#GPollableSourceFunc" title="GPollableSourceFunc ()"><span class="type">GPollableSourceFunc</span></a>. The new source does not actually do
anything on its own; use <a href="./../glib/glib/glib-The-Main-Event-Loop.html#g-source-add-child-source"><code class="function">g_source_add_child_source()</code></a> to add other
sources to it to cause it to trigger.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>pollable_stream</code></em> :</span></p></td>
<td>the stream associated with the new source</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the new <a href="./../glib/glib/glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
</div>
<div class="refsect1">
<a name="GPollableInputStream.see-also"></a><h2>See Also</h2>
<a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>, <a class="link" href="GPollableOutputStream.html" title="GPollableOutputStream"><span class="type">GPollableOutputStream</span></a>, <a class="link" href="GFileDescriptorBased.html" title="GFileDescriptorBased"><span class="type">GFileDescriptorBased</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>